home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Connections.p < prev    next >
Text File  |  1996-05-01  |  11KB  |  324 lines

  1. {
  2.      File:        Connections.p
  3.  
  4.      Contains:    Communications Toolbox Connection Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Connections;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __CONNECTIONS__}
  28. {$SETC __CONNECTIONS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ConnectionsIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __WINDOWS__}
  35. {$I Windows.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __DIALOGS__}
  38. {$I Dialogs.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __CTBUTILITIES__}
  41. {$I CTBUtilities.p}
  42. {$ENDC}
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48. {$IFC FOR_SYSTEM7_ONLY }
  49.  
  50. CONST
  51.                                                                 {     current Connection Manager version     }
  52.     curCMVersion                = 2;                            {     current Connection Manager Environment Record version      }
  53.     curConnEnvRecVers            = 0;                            {  CMErr  }
  54.     cmGenericError                = -1;
  55.     cmNoErr                        = 0;
  56.     cmRejected                    = 1;
  57.     cmFailed                    = 2;
  58.     cmTimeOut                    = 3;
  59.     cmNotOpen                    = 4;
  60.     cmNotClosed                    = 5;
  61.     cmNoRequestPending            = 6;
  62.     cmNotSupported                = 7;
  63.     cmNoTools                    = 8;
  64.     cmUserCancel                = 9;
  65.     cmUnknownError                = 11;
  66.  
  67.  
  68. TYPE
  69.     CMErr                                = OSErr;
  70.  
  71. CONST
  72.     cmData                        = $00000001;
  73.     cmCntl                        = $00000002;
  74.     cmAttn                        = $00000004;
  75.     cmDataNoTimeout                = $00000010;
  76.     cmCntlNoTimeout                = $00000020;
  77.     cmAttnNoTimeout                = $00000040;
  78.     cmDataClean                    = $00000100;
  79.     cmCntlClean                    = $00000200;
  80.     cmAttnClean                    = $00000400;                    {         Only for CMRecFlags (not CMChannel) in the rest of this enum     }
  81.     cmNoMenus                    = $00010000;
  82.     cmQuiet                        = $00020000;
  83.     cmConfigChanged                = $00040000;
  84.  
  85. {  CMRecFlags and CMChannel         }
  86. {         Low word of CMRecFlags is same as CMChannel     }
  87.  
  88. TYPE
  89.     CMRecFlags                            = LONGINT;
  90.     CMChannel                            = INTEGER;
  91.  
  92. CONST
  93.     cmStatusOpening                = $00000001;
  94.     cmStatusOpen                = $00000002;
  95.     cmStatusClosing                = $00000004;
  96.     cmStatusDataAvail            = $00000008;
  97.     cmStatusCntlAvail            = $00000010;
  98.     cmStatusAttnAvail            = $00000020;
  99.     cmStatusDRPend                = $00000040;                    {  data read pending     }
  100.     cmStatusDWPend                = $00000080;                    {  data write pending     }
  101.     cmStatusCRPend                = $00000100;                    {  cntl read pending     }
  102.     cmStatusCWPend                = $00000200;                    {  cntl write pending     }
  103.     cmStatusARPend                = $00000400;                    {  attn read pending     }
  104.     cmStatusAWPend                = $00000800;                    {  attn write pending     }
  105.     cmStatusBreakPend            = $00001000;
  106.     cmStatusListenPend            = $00002000;
  107.     cmStatusIncomingCallPresent    = $00004000;
  108.     cmStatusReserved0            = $00008000;
  109.  
  110.  
  111. TYPE
  112.     CMStatFlags                            = LONGINT;
  113.  
  114. CONST
  115.     cmDataIn                    = 0;
  116.     cmDataOut                    = 1;
  117.     cmCntlIn                    = 2;
  118.     cmCntlOut                    = 3;
  119.     cmAttnIn                    = 4;
  120.     cmAttnOut                    = 5;
  121.     cmRsrvIn                    = 6;
  122.     cmRsrvOut                    = 7;
  123.  
  124.  
  125. TYPE
  126.     CMBufFields                            = INTEGER;
  127.     CMBuffers                            = ARRAY [0..7] OF Ptr;
  128.     CMBufferSizes                        = ARRAY [0..7] OF LONGINT;
  129.  
  130. CONST
  131.     cmSearchSevenBit            = $00000001;
  132.  
  133.  
  134. TYPE
  135.     CMSearchFlags                        = INTEGER;
  136.  
  137. CONST
  138.     cmFlagsEOM                    = $00000001;
  139.  
  140.  
  141. TYPE
  142.     CMFlags                                = INTEGER;
  143.     ConnEnvironRecPtr = ^ConnEnvironRec;
  144.     ConnEnvironRec = RECORD
  145.         version:                INTEGER;
  146.         baudRate:                LONGINT;
  147.         dataBits:                INTEGER;
  148.         channels:                CMChannel;
  149.         swFlowControl:            BOOLEAN;
  150.         hwFlowControl:            BOOLEAN;
  151.         flags:                    CMFlags;
  152.     END;
  153.  
  154.     ConnRecordPtr = ^ConnRecord;
  155.     ConnPtr                                = ^ConnRecord;
  156.     ConnHandle                            = ^ConnPtr;
  157.     ConnectionToolDefProcPtr = ProcPtr;  { FUNCTION ConnectionToolDef(hConn: ConnHandle; msg: INTEGER; p1: LONGINT; p2: LONGINT; p3: LONGINT): LONGINT; }
  158.  
  159.     ConnectionSearchCallBackProcPtr = ProcPtr;  { PROCEDURE ConnectionSearchCallBack(hConn: ConnHandle; matchPtr: Ptr; refNum: LONGINT); }
  160.  
  161.     ConnectionCompletionProcPtr = ProcPtr;  { PROCEDURE ConnectionCompletion(hConn: ConnHandle); }
  162.  
  163.     ConnectionChooseIdleProcPtr = ProcPtr;  { PROCEDURE ConnectionChooseIdle; }
  164.  
  165.     ConnectionToolDefUPP = UniversalProcPtr;
  166.     ConnectionSearchCallBackUPP = UniversalProcPtr;
  167.     ConnectionCompletionUPP = UniversalProcPtr;
  168.     ConnectionChooseIdleUPP = UniversalProcPtr;
  169.     ConnRecord = RECORD
  170.         procID:                    INTEGER;
  171.         flags:                    CMRecFlags;
  172.         errCode:                CMErr;
  173.         refCon:                    LONGINT;
  174.         userData:                LONGINT;
  175.         defProc:                ConnectionToolDefUPP;
  176.         config:                    Ptr;
  177.         oldConfig:                Ptr;
  178.         asyncEOM:                LONGINT;
  179.         reserved1:                LONGINT;
  180.         reserved2:                LONGINT;
  181.         cmPrivate:                Ptr;
  182.         bufferArray:            CMBuffers;
  183.         bufSizes:                CMBufferSizes;
  184.         mluField:                LONGINT;
  185.         asyncCount:                CMBufferSizes;
  186.     END;
  187.  
  188.  
  189. CONST
  190.                                                                 {  CMIOPB constants and structure  }
  191.     cmIOPBQType                    = 10;
  192.     cmIOPBversion                = 0;
  193.  
  194.  
  195. TYPE
  196.     CMIOPBPtr = ^CMIOPB;
  197.     CMIOPB = RECORD
  198.         qLink:                    QElemPtr;
  199.         qType:                    INTEGER;                                {  cmIOPBQType  }
  200.         hConn:                    ConnHandle;
  201.         theBuffer:                Ptr;
  202.         count:                    LONGINT;
  203.         flags:                    CMFlags;
  204.         userCompletion:            ConnectionCompletionUPP;
  205.         timeout:                LONGINT;
  206.         errCode:                CMErr;
  207.         channel:                CMChannel;
  208.         asyncEOM:                LONGINT;
  209.         reserved1:                LONGINT;
  210.         reserved2:                INTEGER;
  211.         version:                INTEGER;                                {  cmIOPBversion  }
  212.         refCon:                    LONGINT;                                {  for application  }
  213.         toolData1:                LONGINT;                                {  for tool  }
  214.         toolData2:                LONGINT;                                {  for tool  }
  215.     END;
  216.  
  217.  
  218. CONST
  219.     uppConnectionToolDefProcInfo = $0000FEF0;
  220.     uppConnectionSearchCallBackProcInfo = $00000FC0;
  221.     uppConnectionCompletionProcInfo = $000000C0;
  222.     uppConnectionChooseIdleProcInfo = $00000000;
  223.  
  224. FUNCTION CallConnectionToolDefProc(hConn: ConnHandle; msg: INTEGER; p1: LONGINT; p2: LONGINT; p3: LONGINT; userRoutine: ConnectionToolDefUPP): LONGINT;
  225.     {$IFC NOT GENERATINGCFM}
  226.     INLINE $205F, $4E90;
  227.     {$ENDC}
  228.  
  229. PROCEDURE CallConnectionSearchCallBackProc(hConn: ConnHandle; matchPtr: Ptr; refNum: LONGINT; userRoutine: ConnectionSearchCallBackUPP);
  230.     {$IFC NOT GENERATINGCFM}
  231.     INLINE $205F, $4E90;
  232.     {$ENDC}
  233.  
  234. PROCEDURE CallConnectionCompletionProc(hConn: ConnHandle; userRoutine: ConnectionCompletionUPP);
  235.     {$IFC NOT GENERATINGCFM}
  236.     INLINE $205F, $4E90;
  237.     {$ENDC}
  238.  
  239. PROCEDURE CallConnectionChooseIdleProc(userRoutine: ConnectionChooseIdleUPP);
  240.     {$IFC NOT GENERATINGCFM}
  241.     INLINE $205F, $4E90;
  242.     {$ENDC}
  243.  
  244. FUNCTION NewConnectionToolDefProc(userRoutine: ConnectionToolDefProcPtr): ConnectionToolDefUPP;
  245.     {$IFC NOT GENERATINGCFM }
  246.     INLINE $2E9F;
  247.     {$ENDC}
  248.  
  249. FUNCTION NewConnectionSearchCallBackProc(userRoutine: ConnectionSearchCallBackProcPtr): ConnectionSearchCallBackUPP;
  250.     {$IFC NOT GENERATINGCFM }
  251.     INLINE $2E9F;
  252.     {$ENDC}
  253.  
  254. FUNCTION NewConnectionCompletionProc(userRoutine: ConnectionCompletionProcPtr): ConnectionCompletionUPP;
  255.     {$IFC NOT GENERATINGCFM }
  256.     INLINE $2E9F;
  257.     {$ENDC}
  258.  
  259. FUNCTION NewConnectionChooseIdleProc(userRoutine: ConnectionChooseIdleProcPtr): ConnectionChooseIdleUPP;
  260.     {$IFC NOT GENERATINGCFM }
  261.     INLINE $2E9F;
  262.     {$ENDC}
  263. FUNCTION InitCM: CMErr;
  264. FUNCTION CMGetVersion(hConn: ConnHandle): Handle;
  265. FUNCTION CMGetCMVersion: INTEGER;
  266. FUNCTION CMNew(procID: INTEGER; flags: CMRecFlags; VAR desiredSizes: CMBufferSizes; refCon: LONGINT; userData: LONGINT): ConnHandle;
  267. PROCEDURE CMDispose(hConn: ConnHandle);
  268. FUNCTION CMListen(hConn: ConnHandle; async: BOOLEAN; completor: ConnectionCompletionUPP; timeout: LONGINT): CMErr;
  269. FUNCTION CMAccept(hConn: ConnHandle; accept: BOOLEAN): CMErr;
  270. FUNCTION CMOpen(hConn: ConnHandle; async: BOOLEAN; completor: ConnectionCompletionUPP; timeout: LONGINT): CMErr;
  271. FUNCTION CMClose(hConn: ConnHandle; async: BOOLEAN; completor: ConnectionCompletionUPP; timeout: LONGINT; now: BOOLEAN): CMErr;
  272. FUNCTION CMAbort(hConn: ConnHandle): CMErr;
  273. FUNCTION CMStatus(hConn: ConnHandle; VAR sizes: CMBufferSizes; VAR flags: CMStatFlags): CMErr;
  274. PROCEDURE CMIdle(hConn: ConnHandle);
  275. PROCEDURE CMReset(hConn: ConnHandle);
  276. PROCEDURE CMBreak(hConn: ConnHandle; duration: LONGINT; async: BOOLEAN; completor: ConnectionCompletionUPP);
  277. FUNCTION CMRead(hConn: ConnHandle; theBuffer: UNIV Ptr; VAR toRead: LONGINT; theChannel: CMChannel; async: BOOLEAN; completor: ConnectionCompletionUPP; timeout: LONGINT; VAR flags: CMFlags): CMErr;
  278. FUNCTION CMWrite(hConn: ConnHandle; theBuffer: UNIV Ptr; VAR toWrite: LONGINT; theChannel: CMChannel; async: BOOLEAN; completor: ConnectionCompletionUPP; timeout: LONGINT; flags: CMFlags): CMErr;
  279. FUNCTION CMIOKill(hConn: ConnHandle; which: INTEGER): CMErr;
  280. PROCEDURE CMActivate(hConn: ConnHandle; activate: BOOLEAN);
  281. PROCEDURE CMResume(hConn: ConnHandle; resume: BOOLEAN);
  282. FUNCTION CMMenu(hConn: ConnHandle; menuID: INTEGER; item: INTEGER): BOOLEAN;
  283. FUNCTION CMValidate(hConn: ConnHandle): BOOLEAN;
  284. PROCEDURE CMDefault(VAR theConfig: Ptr; procID: INTEGER; allocate: BOOLEAN);
  285. FUNCTION CMSetupPreflight(procID: INTEGER; VAR magicCookie: LONGINT): Handle;
  286. FUNCTION CMSetupFilter(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR theEvent: EventRecord; VAR theItem: INTEGER; VAR magicCookie: LONGINT): BOOLEAN;
  287. PROCEDURE CMSetupSetup(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR magicCookie: LONGINT);
  288. PROCEDURE CMSetupItem(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR theItem: INTEGER; VAR magicCookie: LONGINT);
  289. PROCEDURE CMSetupXCleanup(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; OKed: BOOLEAN; VAR magicCookie: LONGINT);
  290. PROCEDURE CMSetupPostflight(procID: INTEGER);
  291. FUNCTION CMGetConfig(hConn: ConnHandle): Ptr;
  292. FUNCTION CMSetConfig(hConn: ConnHandle; thePtr: UNIV Ptr): INTEGER;
  293. FUNCTION CMIntlToEnglish(hConn: ConnHandle; inputPtr: UNIV Ptr; VAR outputPtr: Ptr; language: INTEGER): OSErr;
  294. FUNCTION CMEnglishToIntl(hConn: ConnHandle; inputPtr: UNIV Ptr; VAR outputPtr: Ptr; language: INTEGER): OSErr;
  295. FUNCTION CMAddSearch(hConn: ConnHandle; theString: Str255; flags: CMSearchFlags; callBack: ConnectionSearchCallBackUPP): LONGINT;
  296. PROCEDURE CMRemoveSearch(hConn: ConnHandle; refnum: LONGINT);
  297. PROCEDURE CMClearSearch(hConn: ConnHandle);
  298. FUNCTION CMGetConnEnvirons(hConn: ConnHandle; VAR theEnvirons: ConnEnvironRec): CMErr;
  299. FUNCTION CMChoose(VAR hConn: ConnHandle; where: Point; idle: ConnectionChooseIdleUPP): INTEGER;
  300. PROCEDURE CMEvent(hConn: ConnHandle; {CONST}VAR theEvent: EventRecord);
  301. PROCEDURE CMGetToolName(procID: INTEGER; VAR name: Str255);
  302. FUNCTION CMGetProcID(name: Str255): INTEGER;
  303. PROCEDURE CMSetRefCon(hConn: ConnHandle; refCon: LONGINT);
  304. FUNCTION CMGetRefCon(hConn: ConnHandle): LONGINT;
  305. FUNCTION CMGetUserData(hConn: ConnHandle): LONGINT;
  306. PROCEDURE CMSetUserData(hConn: ConnHandle; userData: LONGINT);
  307. PROCEDURE CMGetErrorString(hConn: ConnHandle; id: INTEGER; VAR errMsg: Str255);
  308. FUNCTION CMNewIOPB(hConn: ConnHandle; VAR theIOPB: CMIOPBPtr): CMErr;
  309. FUNCTION CMDisposeIOPB(hConn: ConnHandle; theIOPB: CMIOPBPtr): CMErr;
  310. FUNCTION CMPBRead(hConn: ConnHandle; theIOPB: CMIOPBPtr; async: BOOLEAN): CMErr;
  311. FUNCTION CMPBWrite(hConn: ConnHandle; theIOPB: CMIOPBPtr; async: BOOLEAN): CMErr;
  312. FUNCTION CMPBIOKill(hConn: ConnHandle; theIOPB: CMIOPBPtr): CMErr;
  313. {$ENDC}
  314. {$ALIGN RESET}
  315. {$POP}
  316.  
  317. {$SETC UsingIncludes := ConnectionsIncludes}
  318.  
  319. {$ENDC} {__CONNECTIONS__}
  320.  
  321. {$IFC NOT UsingIncludes}
  322.  END.
  323. {$ENDC}
  324.